import { defineStore } from 'pinia'
import {ref} from 'vue'
import { getCategoryAPI } from '@/api/api'
export const useCounterStore = defineStore('counter', ()=>{
  // 数据
  const count = ref(0)

  // 修改数据的方法（action）
  const increment = ()=>{
    count.value++
  }

  // 导航列表的数据管理
  const categoryList = ref([])
  const getCategory = async () => {
    const res = await getCategoryAPI()
    categoryList.value = res.result;
  }

  return {
    count,
    increment,

    categoryList,
    getCategory,
  }
})